/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package View;

import java.awt.Component;
import java.awt.Font;
import javax.swing.JOptionPane;

/**
 *
 * @author Bernardo Costa
 */
public class RegPort extends javax.swing.JFrame {

    /**
     * Creates new form RegPort
     */
    public RegPort() {
        super("ThreeDs - Database Data Dictionary");
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        PanelR = new javax.swing.JPanel();
        ThreeDS = new javax.swing.JPanel();
        LinhaLabel = new javax.swing.Box.Filler(new java.awt.Dimension(700, 2), new java.awt.Dimension(700, 5), new java.awt.Dimension(500, 32767));
        ThreeDsLabel = new javax.swing.JLabel();
        DatabaseLabel = new javax.swing.JLabel();
        RegProLabel = new javax.swing.JLabel();
        NomeLabel = new javax.swing.JLabel();
        EmailLabel = new javax.swing.JLabel();
        SenhaLabel = new javax.swing.JLabel();
        CSenhaLabel = new javax.swing.JLabel();
        SenhaField = new javax.swing.JPasswordField();
        CSenhaField = new javax.swing.JPasswordField();
        EmailField = new javax.swing.JTextField();
        NomeField = new javax.swing.JTextField();
        RegButton = new javax.swing.JButton();
        LimparButton = new javax.swing.JButton();
        AjudaButton = new javax.swing.JButton();
        MoreButton = new javax.swing.JButton();
        LessButton = new javax.swing.JButton();
        FontButton = new javax.swing.JLabel();
        MenuSuperior = new javax.swing.JMenuBar();
        Arquivo = new javax.swing.JMenu();
        Sair = new javax.swing.JMenuItem();
        Ajuda = new javax.swing.JMenu();
        Sobre = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setResizable(false);

        PanelR.setBackground(new java.awt.Color(204, 255, 153));
        PanelR.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N

        ThreeDS.setBackground(new java.awt.Color(39, 232, 32));
        ThreeDS.setFont(new java.awt.Font("Times New Roman", 1, 36)); // NOI18N
        ThreeDS.setPreferredSize(new java.awt.Dimension(1200, 200));

        LinhaLabel.setBackground(new java.awt.Color(204, 204, 204));
        LinhaLabel.setOpaque(true);

        ThreeDsLabel.setFont(new java.awt.Font("Times New Roman", 1, 56)); // NOI18N
        ThreeDsLabel.setForeground(new java.awt.Color(255, 255, 255));
        ThreeDsLabel.setText("ThreeDs");

        DatabaseLabel.setFont(new java.awt.Font("Times New Roman", 2, 36)); // NOI18N
        DatabaseLabel.setText("Database Data Dictionary");

        RegProLabel.setFont(new java.awt.Font("Times New Roman", 2, 36)); // NOI18N
        RegProLabel.setForeground(new java.awt.Color(255, 255, 255));
        RegProLabel.setText("Registro de Projetista");

        javax.swing.GroupLayout ThreeDSLayout = new javax.swing.GroupLayout(ThreeDS);
        ThreeDS.setLayout(ThreeDSLayout);
        ThreeDSLayout.setHorizontalGroup(
            ThreeDSLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ThreeDSLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(ThreeDSLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(LinhaLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ThreeDsLabel)
                    .addGroup(ThreeDSLayout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addGroup(ThreeDSLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(RegProLabel)
                            .addComponent(DatabaseLabel))))
                .addContainerGap(130, Short.MAX_VALUE))
        );
        ThreeDSLayout.setVerticalGroup(
            ThreeDSLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ThreeDSLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ThreeDsLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(LinhaLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(DatabaseLabel)
                .addGap(18, 18, 18)
                .addComponent(RegProLabel)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        NomeLabel.setFont(PanelR.getFont());
        NomeLabel.setText("Nome: *");

        EmailLabel.setFont(PanelR.getFont());
        EmailLabel.setText("E-Mail: *");

        SenhaLabel.setFont(PanelR.getFont());
        SenhaLabel.setText("Senha: *");

        CSenhaLabel.setFont(PanelR.getFont());
        CSenhaLabel.setText("Confirme Senha: *");

        SenhaField.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
        SenhaField.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        CSenhaField.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
        CSenhaField.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        EmailField.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
        EmailField.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        NomeField.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
        NomeField.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        RegButton.setText("Registrar");
        RegButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RegButtonActionPerformed(evt);
            }
        });

        LimparButton.setText("Limpar");
        LimparButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                LimparButtonActionPerformed(evt);
            }
        });

        AjudaButton.setText("?");

        MoreButton.setText("+");
        MoreButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MoreButtonActionPerformed(evt);
            }
        });

        LessButton.setText("-");

        FontButton.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        FontButton.setText("Fonte");

        javax.swing.GroupLayout PanelRLayout = new javax.swing.GroupLayout(PanelR);
        PanelR.setLayout(PanelRLayout);
        PanelRLayout.setHorizontalGroup(
            PanelRLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelRLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelRLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelRLayout.createSequentialGroup()
                        .addGroup(PanelRLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(CSenhaLabel)
                            .addComponent(SenhaLabel)
                            .addComponent(EmailLabel)
                            .addComponent(NomeLabel))
                        .addGap(18, 18, 18)
                        .addGroup(PanelRLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(CSenhaField)
                            .addComponent(SenhaField)
                            .addComponent(EmailField)
                            .addComponent(NomeField, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE))
                        .addGap(18, 18, 18)
                        .addComponent(RegButton)
                        .addGap(18, 18, 18)
                        .addComponent(LimparButton)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addComponent(ThreeDS, javax.swing.GroupLayout.DEFAULT_SIZE, 840, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelRLayout.createSequentialGroup()
                        .addComponent(MoreButton)
                        .addGap(18, 18, 18)
                        .addComponent(FontButton)
                        .addGap(18, 18, 18)
                        .addComponent(LessButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(AjudaButton)))
                .addContainerGap())
        );
        PanelRLayout.setVerticalGroup(
            PanelRLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelRLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ThreeDS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(PanelRLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(NomeLabel)
                    .addComponent(NomeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelRLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(EmailLabel)
                    .addComponent(EmailField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelRLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(SenhaLabel)
                    .addComponent(SenhaField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelRLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(CSenhaLabel)
                    .addComponent(CSenhaField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(RegButton)
                    .addComponent(LimparButton))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 155, Short.MAX_VALUE)
                .addGroup(PanelRLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(AjudaButton)
                    .addComponent(MoreButton)
                    .addComponent(LessButton)
                    .addComponent(FontButton))
                .addContainerGap())
        );

        Arquivo.setText("Arquivo");

        Sair.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_4, java.awt.event.InputEvent.ALT_MASK));
        Sair.setText("Sair");
        Sair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SairActionPerformed(evt);
            }
        });
        Arquivo.add(Sair);

        MenuSuperior.add(Arquivo);

        Ajuda.setText("Ajuda");

        Sobre.setText("Sobre");
        Sobre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SobreActionPerformed(evt);
            }
        });
        Ajuda.add(Sobre);

        MenuSuperior.add(Ajuda);

        setJMenuBar(MenuSuperior);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(PanelR, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(PanelR, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void SairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SairActionPerformed
        this.dispose();
    }//GEN-LAST:event_SairActionPerformed

    private void LimparButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LimparButtonActionPerformed
        NomeField.setText(null);
        EmailField.setText(null);
        SenhaField.setText(null);
        CSenhaField.setText(null);
    }//GEN-LAST:event_LimparButtonActionPerformed

    private void SobreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SobreActionPerformed
        JOptionPane.showMessageDialog(null, "ThreeDs - Database Data Dictionary\n"                 + "Copyright 2011 - Universidade de Brasilia\n" + "Versao: 1.0", "Sobre", JOptionPane.PLAIN_MESSAGE);
    }//GEN-LAST:event_SobreActionPerformed

    private void RegButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RegButtonActionPerformed
        String nome, email, password, cpassword;
        char[] senha, csenha;
        
        nome = NomeField.getText();
        email = EmailField.getText();
        senha = SenhaField.getPassword();
        csenha = CSenhaField.getPassword();
        
        password = String.copyValueOf(senha);
        cpassword = String.copyValueOf(csenha);
        
        if(nome.equals("")||nome==null){
            JOptionPane.showMessageDialog(this, "Nome não inserido!");
        }
        if(email.equals("")||email==null){
            JOptionPane.showMessageDialog(this, "Email não inserido!");
        }
        if(password.equals("")||password==null){
            JOptionPane.showMessageDialog(this, "Senha não inserida!");
        }
        if(cpassword.equals("")||cpassword==null){
            JOptionPane.showMessageDialog(this, "Confirmação de senha não inserida!");
        }        
        if(!password.equals(cpassword)){
            JOptionPane.showMessageDialog(this, "As senhas digitadas são diferentes!");
        }
        if((!nome.equals("")&&(!email.equals(""))&&(!password.equals(""))&&(!cpassword.equals("")))) {
            //Ação de Registro//
            
            //Fim da ação de Registro//
            
            this.dispose();
            JOptionPane.showMessageDialog(this, "Registro Efetuado com Sucesso!\n" +
                    "Bem-Vindo ao ThreeDs " + nome + "!");
            
            NomeField.setText(null);
            EmailField.setText(null);
            SenhaField.setText(null);
            CSenhaField.setText(null);
        }
    }//GEN-LAST:event_RegButtonActionPerformed

    private void MoreButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MoreButtonActionPerformed

    }//GEN-LAST:event_MoreButtonActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(RegPort.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(RegPort.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(RegPort.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(RegPort.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                new RegPort().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu Ajuda;
    private javax.swing.JButton AjudaButton;
    private javax.swing.JMenu Arquivo;
    private javax.swing.JPasswordField CSenhaField;
    private javax.swing.JLabel CSenhaLabel;
    private javax.swing.JLabel DatabaseLabel;
    private javax.swing.JTextField EmailField;
    private javax.swing.JLabel EmailLabel;
    private javax.swing.JLabel FontButton;
    private javax.swing.JButton LessButton;
    private javax.swing.JButton LimparButton;
    private javax.swing.Box.Filler LinhaLabel;
    private javax.swing.JMenuBar MenuSuperior;
    private javax.swing.JButton MoreButton;
    private javax.swing.JTextField NomeField;
    private javax.swing.JLabel NomeLabel;
    public javax.swing.JPanel PanelR;
    private javax.swing.JButton RegButton;
    private javax.swing.JLabel RegProLabel;
    private javax.swing.JMenuItem Sair;
    private javax.swing.JPasswordField SenhaField;
    private javax.swing.JLabel SenhaLabel;
    private javax.swing.JMenuItem Sobre;
    private javax.swing.JPanel ThreeDS;
    private javax.swing.JLabel ThreeDsLabel;
    // End of variables declaration//GEN-END:variables
}
